package sqlserver;

import java.sql.Connection;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class Beihang {
    public static void main(String[] args) throws Exception {
        Class.forName("net.sourceforge.jtds.jdbc.Driver");
        Connection srcConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.99.100:1433/kydb", "sa", "Ep123");
        Connection tarConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://172.16.1.5:1433/RDSYSEDUV810006_zjk", "sa", "Ep123!@#");
        try {
            DBInfo srcInfo = new DBInfo(srcConn, null, DBName.SqlServer2005);
            DBInfo tarInfo = new DBInfo(tarConn, null, DBName.SqlServer2005);
            DBUtils.dbConvertA2B(srcInfo, tarInfo, true);
//          FileOutputStream fos = new FileOutputStream("/Users/firefly/Desktop/a.sql");
//          OutputStreamWriter osw = new OutputStreamWriter(fos);
//          DBUtils.expertInsertSQL(srcInfo, srcInfo.getDialect(), osw, new String[]{"SYS_MENU"}, null, true);
//          File sqlFile = new File("/Users/firefly/Desktop/eadp5_1.sql");
//          DBUtils.dbConvertA2SqlFile(srcInfo, sqlFile);
        } finally{
            srcConn.close();
            tarConn.close();
        }
    }
}
